const path = require('path') //必须引入
const resolve = dir => path.join(__dirname, dir)//必须引入 
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  //配置代理
  transpileDependencies: true,
  publicPath:"./",
  lintOnSave :false,
  outputDir: process.env.VUE_APP_outputDir || 'dist', 
  assetsDir: 'static' ,// 配置js、css静态资源二级目录的位置  
  lintOnSave: false,
  runtimeCompiler: false,
  transpileDependencies: [],
  productionSourceMap: false,
  devServer: {
    port: 8001,  
    open: false,
    client: {
      overlay: {
        warnings: true,
        errors: true,
      },
    },
    proxy: {
      '/api': { 
        target: 'http://123.60.222.128:9999',  
        pathRewrite: {
          '^/api': '/'
        }
      }
    } 
  },
  // 配置svg
  chainWebpack: config => {
    config.module
    .rule('svg')
    .exclude.add(resolve('src/icons')) //对应下面配置svg的路径
    .end();

    config.module
    .rule('icons')
    .test(/\.svg$/)
    .include.add(resolve('src/icons')) //对应下面配置svg的路径
    .end()
    .use('svg-sprite-loader')
    .loader('svg-sprite-loader')
    .options({
      symbolId: 'icon-[name]'
    });
  },
})